/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "../../帧缓存.h"
#include "../Core/Vk结构声明.h"



struct S_Vk帧缓存 : public S_帧缓存 {
	VkDevice		m_设备;
	VkRenderPass	m_渲染通道;

	VkClearValue          m_背景清除值[4];
	uint32                m_全屏数量;
	VkRenderPassBeginInfo m_开始渲染信息;

	S_Vk帧缓存(const uvec2 size);

	//void	f_构建帧缓存(VkDevice& dev, VkRenderPass& rp);
	void	f_构建交换链缓存(VkDevice& dev, bool 深度, uint8 附件数量);
	void	f_构建交换链缓存(S_设备环境& ctx, uint8 附件数量);
	void	f_构建阴影帧缓存(VkDevice& dev, const VkRenderPass& rp);

	void	f_release(bool 销毁交互纹理 = false);
	void	f_reSize(uvec2 size);

	
	vector<VkFramebuffer>	m_帧缓存;
	//需要优化
	vector<S_VkImage*>		m_交换面颜色缓存;
	vector<S_VkImage*>		m_交换面深度缓存;
};



VkRenderPass f_fb_创建环境渲染通道(VkDevice 设备, E_纹理格式 颜色格式, E_纹理格式 深度格式);

VkRenderPass f_fb_创建合成渲染通道(VkDevice& dev, const VkFormat& 颜色格式, const VkFormat& 深度格式, E_MS次数 采样次数 = E_MS次数::e_MS_1);
VkRenderPass f_fb_创建几何缓存渲染通道(VkDevice& dev, const VkFormat& 颜色格式, const VkFormat& 深度格式, E_MS次数 采样次数 = E_MS次数::e_MS_1);

VkRenderPass f_fb_创建渲染通道(VkDevice& dev, const VkFormat& 颜色格式, bool 窗口呈现);
VkRenderPass f_fb_创建交换链渲染通道(VkDevice& dev, const VkFormat& 颜色格式, const VkFormat& 深度格式, E_MS次数 采样次数 = E_MS次数::e_MS_1);

void f_frame_构建交换链缓存(S_Vk帧缓存& frame, bool 多重采样);




S_帧缓存*	f_fb_创建UI合成帧缓存(S_设备环境& ctx, uint32 num, const uvec2& faceSize, S_纹理* tex[4]);
void		f_fb_重置UI合成帧缓存(S_设备环境& ctx, S_帧缓存* fb, const uvec2& faceSize, S_纹理* color[4]);
void		f_fb_销毁UI合成帧缓存(S_设备环境& ctx, S_帧缓存* fb);



